//
//  BuyTableViewCell.swift
//  jiaoyi
//
//  Created by wjk on 2018/8/14.
//  Copyright © 2018年 wjk. All rights reserved.
//

import UIKit
import SwiftyJSON
@objc protocol BuyCellDelegate {
    @objc optional func zhuanClick(_ cell :BuyTableViewCell)
    @objc optional func anpai(_ cell :BuyTableViewCell)
}

class BuyTableViewCell: UITableViewCell {
    
    @IBOutlet weak var nameLabel: UILabel!
    @IBOutlet weak var typeLabel: UILabel!
    @IBOutlet weak var dateLabel: UILabel!
    @IBOutlet weak var categoryLabel: UILabel!
    @IBOutlet weak var regoinLabel: UILabel!
    @IBOutlet weak var statusLabel: UILabel!
    weak var delegate : BuyCellDelegate?
    
    var model: JSON!{
        didSet{
            nameLabel.text = model["name"].stringValue
            typeLabel.text = model["trade_type_text"].stringValue
            dateLabel.text = model["trade_date"].stringValue
            categoryLabel.text = model["varieties_text"].stringValue
            regoinLabel.text = model["regions_text"].stringValue
            statusLabel.text = model["status_text"].string
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    @IBAction func zhuan(_ sender: UIButton) {
        
        delegate?.zhuanClick!(self)
    }
    
    @IBAction func anpai(_ sender: UIButton) {
        delegate?.anpai!(self)
    }
}
